/**
 * Created by jijin on 2017/7/22.
 * 
 * handle back button for android
 */

import {
  Alert,
  BackAndroid
} from 'react-native';

export default function () {
  let {navigator} = this.props;
  if (navigator.getCurrentRoutes().length <= 1) {
    Alert.alert(
      '退出',
      '想好了？',
      [
        {text: '没', onPress: () => null},
        {text: '恩', onPress: () => BackAndroid.exitApp()}
      ]
    )
  } else {
    navigator.pop();
  }
  return true;
}
